package com.job.dao;


import com.job.pojo.JobInfo;
import com.job.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * @author Surpass
 * @Package com.job.dao
 * @Description: ${todo}
 * @date 2020/4/30 18:32
 */
@Component
public class DataPipline implements Pipeline {

    @Autowired
    private JobService jobService;
    @Override
    public void process(ResultItems resultItems, Task task) {
        //获取实体类对象
        JobInfo jobInfo = resultItems.get("jobInfo");
        //是否为空
        if (jobInfo!=null){
            //保存
            this.jobService.save(jobInfo);
        }
    }
}
